package com.le.leauth.service;

import com.le.leauth.domain.dto.LoginDTO;
import com.le.leauth.domain.dto.RegisterDTO;
import com.le.leauth.domain.vo.LoginUserInformationVO;
import me.zhyd.oauth.model.AuthCallback;

import javax.mail.MessagingException;
import javax.security.auth.message.AuthException;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.rmi.ServerException;

public interface AuthService {

    /**
     * 用户登录
     * @param loginDTO
     * @return
     * @throws ServerException
     */
    LoginUserInformationVO loginAndGetInfo(LoginDTO loginDTO) throws ServerException;


    /**
     *  获取第三方授权地址
     * @param source
     * @return
     * @throws AuthException
     */
    String getAddress(String source) throws AuthException;

    /**
     * 用户第三方登录
     * @param callback
     * @param httpServletResponse
     * @param source
     */
    void authLogin(AuthCallback callback, HttpServletResponse httpServletResponse, String source) throws AuthException, IOException;

    /**
     * 获取验证码
     * @param email
     * @return
     * @throws MessagingException
     */
    Boolean sendEmail(String email) throws MessagingException;

    /**
     * 注册
     * @param registerDTO
     * @return
     */
    Boolean register(RegisterDTO registerDTO);

    /**
     * 修改密码
     * @param registerDTO
     * @return
     */
    Boolean forgotPassword(RegisterDTO registerDTO);
}
